<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition template="/template.xhtml">
        <ui:define name="title">
            <h:outputText value="#{bundle.EditProjectsTitle}"></h:outputText>
        </ui:define>
        <ui:define name="body">
            <h:panelGroup id="messagePanel" layout="block">
                <h:messages errorStyle="color: red" infoStyle="color: green" layout="table"/>
            </h:panelGroup>
            <h:form>
                <h:panelGrid columns="2">
                    
                    <h:outputLabel value="#{bundle.EditProjectsLabel_projectCode}" for="projectCode" />
                    <h:inputText id="projectCode" value="#{projectsController.selected.projectCode}" title="#{bundle.EditProjectsTitle_projectCode}" required="true" requiredMessage="#{bundle.EditProjectsRequiredMessage_projectCode}"/>
                    
                    <h:outputLabel value="#{bundle.EditProjectsLabel_projectName}" for="projectName" />
                    <h:inputText id="projectName" value="#{projectsController.selected.projectName}" title="#{bundle.EditProjectsTitle_projectName}" required="true" requiredMessage="#{bundle.EditProjectsRequiredMessage_projectName}"/>
                    
                    <h:outputLabel value="#{bundle.EditProjectsLabel_activityCode}" for="activityCode" />
                    <h:inputText id="activityCode" value="#{projectsController.selected.activityCode}" title="#{bundle.EditProjectsTitle_activityCode}" />
                    
                    <h:outputLabel value="#{bundle.EditProjectsLabel_status}" for="status" />
                    <h:inputText id="status" value="#{projectsController.selected.status}" title="#{bundle.EditProjectsTitle_status}" required="true" requiredMessage="#{bundle.EditProjectsRequiredMessage_status}"/>
                    
                    <h:outputLabel value="#{bundle.EditProjectsLabel_customer}" for="customer" />
                    <h:selectOneMenu id="customer" value="#{projectsController.selected.customer}" title="#{bundle.EditProjectsTitle_customer}" required="true" requiredMessage="#{bundle.EditProjectsRequiredMessage_customer}">
                        <f:selectItems value="#{customersController.itemsAvailableSelectOne}"/>
                    </h:selectOneMenu>
                    
                </h:panelGrid>
                <h:commandButton action="#{projectsController.update}" value="#{bundle.EditProjectsSaveLink}"/>
                <h:commandButton action="View" value="#{bundle.EditProjectsViewLink}" immediate="true"/>
                </h:form>
            
            <h:form>
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
               <h:commandButton  action="#{projectsController.prepareList}" value="#{bundle.EditProjectsShowAllLink}" immediate="true"/>
                <h:button rendered="${type=='admin'}" value="Back to Home" outcome="/index" />
            </h:form>
        </ui:define>
    </ui:composition>

</html>
